#include "Camera.h"
#include "D3DManager.h"

Camera::Camera()
{
	ResetCamera(Vector3(0,0,-2),Vector3(0,0,0),Vector3(0,1,0));
	ResetProjection(ToRadian(75),D3DManager::getInstance()->getWndWidth()/(float)D3DManager::getInstance()->getWndHeight(),.01f,100.0f);
}

Camera::~Camera()
{

}

Camera* Camera::getInstance()
{
	static Camera instance;
	return &instance;
}

void Camera::ResetCamera( const Vector3 &eye,const Vector3 &at,const Vector3 &up )
{
	D3DXMatrixLookAtLH(&cam,&eye,&at,&up);
}

void Camera::ResetProjection(float FOV,float fAspectRatio,float zNear,float zFar)
{
	// Create the projection matrix
	//float fov = (D3DXToRadian(75)), aspect = ((wndWidth)/(float)wndHeight), znear = 0.01f, zfar = 100.0f; 
	D3DXMatrixPerspectiveFovLH(&proj,FOV,fAspectRatio,zNear,zFar);
}
